-
Notifications
You must be signed in to change notification settings - Fork 4
Bugfix: min_duration and max_speed in trajectory filter #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #371 +/- ##
==========================================
- Coverage 83.34% 83.20% -0.15%
==========================================
Files 52 52
Lines 5207 5233 +26
Branches 593 596 +3
==========================================
+ Hits 4340 4354 +14
- Misses 855 867 +12
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| auto const& lons = std::get<std::vector<double>>(dataframe.at("lon")); | ||
|
|
||
| auto const bbox_set = | ||
| !(bbox[0] == 0.0 && bbox[1] == 0.0 && bbox[2] == 0.0 && bbox[3] == 0.0); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
| tbb::concurrent_set<Id> to_split; | ||
|
|
||
| // Returns true if speed between two points is below max_speed_kph | ||
| auto check_max_speed = [](PointsCluster const& currentCluster, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
|
|
||
| // Returns true if speed between two points is below max_speed_kph | ||
| auto check_max_speed = [](PointsCluster const& currentCluster, | ||
| PointsCluster const& previousCluster, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| // Returns true if speed between two points is below max_speed_kph | ||
| auto check_max_speed = [](PointsCluster const& currentCluster, | ||
| PointsCluster const& previousCluster, | ||
| double const max_speed_kph) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.1 rule Note
| if (current_time <= previous_time) { | ||
| spdlog::warn( | ||
| "Non-increasing timestamps detected. Skipping speed check for these points."); | ||
| return true; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| [&to_remove, | ||
| &to_split, | ||
| check_max_speed, | ||
| check_min_duration, |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| to_split.insert(uid); | ||
| return; | ||
| } | ||
| if (i > 0) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
| return; | ||
| } | ||
| if (i > 0) { | ||
| auto const& previousCluster = points[i - 1]; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
|
|
||
| bool bShouldSplit = false; | ||
|
|
||
| if (i > 0) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
| bool bShouldSplit = false; | ||
|
|
||
| if (i > 0) { | ||
| auto const& previousCluster = points[i - 1]; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.4 rule Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to fix bugs in the trajectory filtering logic related to min_duration and max_speed constraints. The changes introduce helper lambda functions for speed and duration checks, refactor the filtering logic to use these helpers, and move the bbox_set calculation outside the loop for performance.
Key Changes:
- Added
check_max_speedandcheck_min_durationhelper lambdas to encapsulate constraint validation logic - Introduced time conversion constants (
SECONDS_IN_MINUTE,SECONDS_IN_HOUR) to avoid magic numbers - Refactored both the detection phase (lines 144-158) and splitting phase (lines 184-203) to use the new helper functions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.